home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / kernel / stcon.c < prev    next >
C/C++ Source or Header  |  1990-07-15  |  3KB  |  149 lines

  1. #if (CHIP == M68000)
  2. /*
  3.  * The console driver for the Atari ST
  4.  */
  5. #define DEBDMP        /* dump system tables */
  6. #undef    TTYDMP        /* dump tty info  */
  7. #define DEBOUT        /* debugging on console and/or printer */
  8.  
  9. #include "kernel.h"
  10. #include <signal.h>
  11. #include <sgtty.h>
  12.  
  13. #include "proc.h"
  14. #include "tty.h"
  15.  
  16. #ifdef DEBOUT
  17. PRIVATE int    STuseCon = 0;
  18. PRIVATE int    STusePrt = 0;
  19. #endif
  20. #ifdef DEBDMP
  21. PRIVATE int    STdoDump = 0;
  22. #endif
  23.  
  24. /*===========================================================================*
  25.  *                tty_init                     *
  26.  *===========================================================================*/
  27. PUBLIC void tty_init()
  28. {
  29.   struct tty_struct *tp;
  30.  
  31.   for (tp = &tty_struct[0]; tp < &tty_struct[NR_CONS]; tp++) {
  32.     tp->tty_inhead = tp->tty_inqueue;
  33.     tp->tty_intail = tp->tty_inqueue;
  34.     tp->tty_mode = CRMOD | XTABS | ECHO;
  35.  
  36. #if (CHIP != M68000)
  37.     /* atari does this in vduinit() */
  38.     tp->tty_devstart = console;
  39. #endif
  40.     tp->tty_makebreak = TWO_INTS;
  41. #if (CHIP != M68000)
  42.     tp->tty_attribute = BLANK;
  43. #endif
  44.     tp->tty_erase = ERASE_CHAR;
  45.     tp->tty_kill  = KILL_CHAR;
  46.     tp->tty_intr  = INTR_CHAR;
  47.     tp->tty_quit  = QUIT_CHAR;
  48.     tp->tty_xon   = XON_CHAR;
  49.     tp->tty_xoff  = XOFF_CHAR;
  50.     tp->tty_eof   = EOT_CHAR;
  51.   }
  52.  
  53.   tty_buf_max(tty_driver_buf) = MAX_OVERRUN;    /* set up limit on keyboard buffering*/
  54.   tty_buf_count(tty_driver_buf) = 0;
  55.  
  56.   vduinit();
  57.   kbdinit();
  58. #ifdef DEBOUT
  59.   STuseCon = 1;        /* debugging putc() goes (also) to console */
  60. #endif
  61. }
  62.  
  63. /*===========================================================================*
  64.  *                func_key                     *
  65.  *===========================================================================*/
  66. PUBLIC int func_key(pfx)
  67. int pfx;
  68. {
  69.     int i;
  70.  
  71. /* handle CTRL-ALT-PFX sequences */
  72.     
  73.   switch (pfx) {
  74. #ifdef DEBDMP
  75.   case F1:    /* PF1: print process table */
  76.     p_dmp(); return;
  77.   case F2:    /* PF2: print memory map */
  78.     map_dmp(); return;
  79.   case F3:    /* PF3: print regs user prog */
  80.     reg_dmp(bill_ptr); return; /* ++jrb */
  81.   case F6:    /* PF6: ON/OFF dump tables on panic */
  82.     STdoDump ^= 1; return;
  83. #endif
  84. #ifdef DEBOUT
  85.   case F4:    /* PF4: ON/OFF console debugging */
  86.     STuseCon ^= 1; return;
  87.   case F5:    /* PF5: ON/OFF printer debugging */
  88.     STusePrt ^= 1; return;
  89. #endif
  90. #ifdef DEBDMP
  91. #ifdef TTYDMP
  92.   case F7:    /* PF7: dump tty info */
  93.     tty_dmp(); return;
  94. #endif
  95. #endif
  96.   case F10:    /* PF10: issue SIGKILL */
  97.     for (i = 0; i < NR_CONS; i++)
  98.     {
  99.         sigchar(&tty_struct[i], SIGKILL); return;
  100.     }
  101.   default:
  102.     return; /* don't bomb out */
  103.   }
  104. }
  105.  
  106. /*===========================================================================*
  107.  *                dump                         *
  108.  *===========================================================================*/
  109. PUBLIC void dump()
  110. {
  111. #ifdef DEBDMP
  112.   if (STdoDump == 0)
  113.     return;
  114.   printf("dump\n");
  115.   reg_dmp(proc_ptr); /* ++jrb */
  116.   p_dmp();
  117.   map_dmp();
  118. #endif
  119. }
  120.  
  121. /*===========================================================================*
  122.  *                putc                         *
  123.  *===========================================================================*/
  124. /* 
  125.  * This procedure is used by the kernel version of printf().
  126.  * The one in the library sends a message to FS, which is not
  127.  * needed for printing within the kernel.
  128.  */
  129. PUBLIC void putc(c)
  130. int c;
  131. {
  132. #ifdef DEBOUT
  133. /*
  134.  * Use any combination of the printer or the console.
  135.  */
  136.  
  137.   if (STuseCon) {
  138. #endif
  139.     vducursor(0);
  140.     out_char(&tty_struct[CONSOLE], c);
  141.     vducursor(1);
  142. #ifdef DEBOUT
  143.   }
  144.   if (STusePrt)
  145.     prtc(c);
  146. #endif
  147. }
  148. #endif
  149.